//
//  RollingViewController.m
//  基本框架
//
//  Created by runone02 on 2018/8/16.
//  Copyright © 2018年 liqiyun. All rights reserved.
//

#import "RollingViewController.h"
#import <SDCycleScrollView.h>
#import "RollingView.h"

@interface RollingViewController ()<SDCycleScrollViewDelegate>
/** */
@property (nonatomic, strong) RollingView *rollingView;

@end

@implementation RollingViewController

- (void)viewDidLoad {

    [super viewDidLoad];

    [self loadSDcycle];
}


- (void)loadSDcycle{
    NSArray *imageArr = @[@"行",@"组-35",@"headBg",@"组-35",@"headBg",@"行"];
    SDCycleScrollView * cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, kTopBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT/3) imageNamesGroup:imageArr];
//    SDCycleScrollView *cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, self.view.width, SCALE_HIGHT(400)) delegate:self placeholderImage:IMAGE(@"cycle_placeHolder")];
    cycleScrollView.currentPageDotColor = RGBA(46, 88, 117, 1);
    cycleScrollView.pageDotColor = RGBA(156, 156, 156, 1);
    cycleScrollView.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
    cycleScrollView.pageControlDotSize = CGSizeMake(20, 20);
    cycleScrollView.hidden = NO;
    cycleScrollView.delegate = self;
    cycleScrollView.backgroundColor = COLOR_WHITE;
    cycleScrollView.autoScrollTimeInterval = 3.0;
    
    [self.view addSubview:cycleScrollView];
    
    self.rollingView = [[RollingView alloc]init];
    [self.view addSubview:_rollingView];
    [self.rollingView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(cycleScrollView.mas_bottom).with.offset(10);
        make.left.mas_equalTo(self.view).with.offset(10);
        make.right.mas_equalTo(self.view).with.offset(-10);
        make.bottom.mas_equalTo(self.view).with.offset(-10);
    }];
}

//点击滚动图片
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index{
    NSLog(@"点击的图片%ld",index);
}

@end
